package com.itheima.pinda.web;

import com.itheima.pinda.service.ReloadDroolsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author llhuang10
 * @date 2021/10/12 16:07
 */
@Slf4j
@RestController
@RequestMapping("/rules")
public class RulesReloadController {


    @Resource
    private ReloadDroolsService reloadDroolsService;

    /**
     * 从数据库加载最新规则
     */
    @GetMapping("/reload")
    public String reload() throws Exception {
        reloadDroolsService.reload();
        return "ok";
    }
}
